/**
 *  Copyright 2011 Pavlov Dm.
 *  Licensed under the MIT License
 */
 
package org.motiv.tests.config;

import org.motiv.config.CacheConfiguration;

import org.junit.Test;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;


/**
 * A cache configuration tests.
 * @author Pavlov Dm
 */

 public class CacheConfigurationTest{
	/** Cache configuration instance*/
	CacheConfiguration config;
	@Before
    public void setUp(){
		if(config==null) {
			config = CacheConfigurationFactory.create();		
		}
    }
	@Test
	public void check_getName_method() {
		assertEquals("Check cache name",CacheConfigurationFactory.EXPECTED_NAME,config.getName());
	}
	@Test
	public void check_getMaxElementsInMemory_method() {
		assertEquals("Check cache max elements in memory",CacheConfigurationFactory.EXPECTED_MAX_ELEMENTS_IN_MEMORY,config.getMaxElementsInMemory());
	}
	@Test
	public void check_getMaxElementsOnDisk_method() {
		assertEquals("Check cache max elements on disk",CacheConfigurationFactory.EXPECTED_MAX_ELEMENTS_ON_DISK,config.getMaxElementsOnDisk());
	}
	@Test
	public void check_isEternal_method() {
		assertEquals("Check cache eternal",CacheConfigurationFactory.EXPECTED_ETERNAL,config.isEternal());
	}
	@Test
	public void check_getTimeToIdleSeconds_method() {
		assertEquals("Check cache time to idle",CacheConfigurationFactory.EXPECTED_TIME_TO_IDLE_SECONDS,config.getTimeToIdleSeconds());
	}
	@Test
	public void check_getTimeToLiveSeconds_method() {
		assertEquals("Check cache time to live",CacheConfigurationFactory.EXPECTED_TIME_TO_LIVE_SECONDS,config.getTimeToLiveSeconds());
	}
	@Test
	public void check_isOverflowToDisk_method() {
		assertEquals("Check cache overflow to disk",CacheConfigurationFactory.EXPECTED_OVERFLOW_TO_DISK,config.isOverflowToDisk());
	}
	@Test
	public void check_getDiskSpoolBufferSizeMB_method() {
		assertEquals("Check cache disks pool buffer size in mb",CacheConfigurationFactory.EXPECTED_DISK_SPOOL_BUFFER_SIZE_MB,config.getDiskSpoolBufferSizeMB());
	}	
	@Test
	public void check_getMemoryStoreEvictionPolicy_method() {
		assertEquals("Check cache disks pool buffer size in mb",CacheConfigurationFactory.EXPECTED_MEMORY_STORE_EVICTION_POLICY,config.getMemoryStoreEvictionPolicy().getName());
	}		
	@After
    public void tearDown(){
		config = null;
    }
}